package pacs.sgc.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conexao implements IConexao{

	private Connection con;
	
	public Conexao(){}
	
	public void abrirConexao() throws ClassNotFoundException, SQLException{
		//MySql
		Class.forName("com.mysql.jdbc.Driver");
		con = DriverManager.getConnection("jdbc:mysql://localhost/sgcbd", "root", "root");
		//Hsqldb
//		Class.forName("org.hsqldb.jdbcDriver" );
//		con = DriverManager.getConnection("jdbc:hsqldb:file:/db/sgcbd","sa","");		
	}
	
	public void fecharConexao() throws SQLException{
		if(con != null)
			con.close();
	}

	public Connection getCon() {
		return con;
	}
	
}
